import * as React from 'react';
import styled from 'styled-components';

interface textProps {
    text?: string;
    children?: any;
    audio?: string;
}

const TextC = styled.div`
    display: inline-flex,
`;

const TextSpan = styled.div`
    cursor: pointer;
    color: #1890ff;
`;

function AudioText(props: textProps = { text: '', audio: '' }) {

    const play = () => {
        console.log('play');
    };

    return <TextC>
        <TextSpan onClick={play}>{props.text}</TextSpan>
        <audio src={props.audio}></audio>
    </TextC>;
}

export default AudioText;